const name = process['env']['VUE_APP_GITHUB_USER_NAME']
const noTest = name !== 'test'
const noEmpty = name !== 'undefined'
const dev = process['env']['NODE_ENV'] === 'development'

// 加载雪碧图
import '@/icon'
// 加载全局样式样式
import './styles/vab.scss'

import './styles/icon-font/icon.css'
import { createHead } from '@vueuse/head'

export function setupVab(app) {
  if ((noTest && noEmpty) || dev) {
    app.use(createHead())

    // 加载背景
    const Themes = require.context('./styles/background', false, /\.scss$/)
    Themes.keys().map(Themes)

    // 加载插件
    const Plugins = require.context('./plugins', true, /\.js$/)
    Plugins.keys().forEach((key) => Plugins(key).setup(app))
  }
}
